package com.chunuo.blogs.service.impl;

import com.chunuo.blogs.dao.UserDao;
import com.chunuo.blogs.entity.User;
import com.chunuo.blogs.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * 类的作用
 *
 * @author liujiamiao
 * @email 2544296058@qq.com
 * @date 2020-05-14 16:41
 */
@CacheConfig(cacheManager = "redisCacheManager",cacheNames={"user"})
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User login(String username) {
        return userDao.login(username);
    }

    @Cacheable(value = {"user"},condition = "#a0>0",unless = "#a0==0")
    @Override
    public String findById(Integer id) {
        return "success!";
    }
}
